package com.buding.fx.service.impl;

import com.buding.fx.common.constant.CssStyleInfo;
import com.buding.fx.entity.Menu;
import com.buding.fx.entity.SystemConfigInfo;
import com.buding.fx.service.CenterPageBuildService;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;

import java.util.List;

/**
 * @author mingdongwei-jwk
 * @date 2022/09/30 10:40
 * @class com.buding.fx.service.impl
 * @Description
 */
public class AbsPageBuildService extends BasePageBuildSerivce{
    CenterPageBuildService centerPageBuildService;
    Menu menu;
    SystemConfigInfo systemConfigInfo;

    AbsPageBuildService(Menu menu, SystemConfigInfo systemConfigInfo,CenterPageBuildService centerPageBuildService){
        this.centerPageBuildService = centerPageBuildService;
        this.menu = menu;
        this.systemConfigInfo = systemConfigInfo;
    }

    AbsPageBuildService(Menu menu, SystemConfigInfo systemConfigInfo){
        this.menu = menu;
        this.systemConfigInfo = systemConfigInfo;
    }

    /**
     * 构建顶部导航标题
     * @return
     */
    public Node buildTopNode(){
        Node returnNode = null;
        if (centerPageBuildService!=null){
            returnNode = centerPageBuildService.buildTopNode(menu,systemConfigInfo);
        }
        if (returnNode==null && menu!=null && systemConfigInfo!=null){
            returnNode = addTitle(systemConfigInfo.getCss(),menu.getPath());
        }
        return returnNode;
    }

    /**
     * 构建搜索区域，主要是搜索条件和搜索按钮构成（搜索条件根据类注解自动判断）
     * @return
     */
    Node buildSearchNode(){
        if (centerPageBuildService!=null){
            return centerPageBuildService.buildSearchNode(menu,systemConfigInfo);
        }
        //如果没有改跳转页面实现的构造方法，默认构造器将会根据menu跳转的url，实现默认的搜索页面
        return null;
    }

    /**
     * 构建搜索结果的分页tableView
     * @return
     */
    Node bulidSerchResultNode(){
        if (centerPageBuildService!=null){
            return centerPageBuildService.bulidSerchResultNode(menu,systemConfigInfo);
        }
        return null;
    }



}
